package com.hzz.web.area;

import com.alibaba.fastjson.JSONObject;
import com.hzz.api.area.IAreaService;
import com.hzz.dao.eybase.*;
import com.hzz.dao.patrol.IPatrolTaskDao;
import com.hzz.dao.report.IReportEventDao;
import com.hzz.dao.user.IUserDao;
import com.hzz.dto.area.AreaDto;
import com.hzz.entity.dsync.DSync;
import com.hzz.entity.patrol.PatrolTask;
import com.hzz.entity.report.ReportEvent;
import com.hzz.framework.Response;
import com.hzz.framework.annotation.NoAuthorize;
import com.hzz.framework.scheduling.JobsSchedulingConfigurer;
import com.hzz.framework.util.*;
import com.hzz.framework.web.controller.BaseController;
import com.hzz.service.dsync.EyBaseTaskDSync;
import com.hzz.task.DSyncTask;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@Api(description = "行政区划")
@RestController
@Slf4j
@NoAuthorize
public class AreaController extends BaseController {
    @Autowired
    IAreaService areaService;
    @Autowired
    DSyncTask dSyncTask;
    //    @Autowired
//    IDSyncExistDao syncExistDao;
    @Autowired
    IPatrolTaskDao patrolTaskDao;
    @Autowired
    IReportEventDao reportEventDao;
    @Autowired
    EyBaseTaskDSync eyBaseTaskDSync;
    @Autowired
    EhcacheUtil cache;

    @Autowired
    IEyBaseRetrieveChnDao eyBaseRetrieveChnDao;
    @Autowired
    IEyBaseRetrieveChnSliceDao eyBaseRetrieveChnSliceDao;
    @Autowired
    IEyBaseRetrieveChnGmDao eyBaseRetrieveChnGmDao;
    @Autowired
    IEyBaseRetrieveGmDao eyBaseRetrieveGmDao;
    @Autowired
    IEyBaseRetrieveGmHydlDao eyBaseRetrieveGmHydlDao;
    @Autowired
    IEyBaseRetrieveReachDao eyBaseRetrieveReachDao;
    @Autowired
    IEyBaseRetrieveRegionDao eyBaseRetrieveRegionDao;
    @Autowired
    IEyBaseRetrieveReservoirsDao eyBaseRetrieveReservoirsDao;
    @Autowired
    IEyBaseRetrieveReservoirsSliceDao eyBaseRetrieveReservoirsSliceDao;
    @Autowired
    IEyBaseRetrieveReservoirsGmDao eyBaseRetrieveReservoirsGmDao;
    @Autowired
    IEyBaseRetrieveRiversDao eyBaseRetrieveRiversDao;
    @Autowired
    IUserDao userDao;
    private static final String acPrefix = "/area/";

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "list")
    // @ApiOperation(value = "地区列表")
    public Response list(@ModelAttribute AreaDto dto) {
        log.info("list.........");
        Response result = new Response();
        try {
            result.data = areaService.findDataIsList(dto);
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "dsync")
    public Response dsync() {
        log.info("dsync.........");
        Response result = new Response(0, "临时更新触发接口");
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("01.推送-巡查任务", acPrefix + "dsync/task");
            jsonObject.put("02.推送-巡查事件", acPrefix + "dsync/event");
            jsonObject.put("03.统计-任务/事件(推送)", acPrefix + "dsync/state");
            jsonObject.put("04.拉取-行政区划", acPrefix + "ebase/xzqh");
            jsonObject.put("05.拉取-河长", acPrefix + "ebase/hz");
            jsonObject.put("06.拉取-河流", acPrefix + "ebase/hl");
            jsonObject.put("07.拉取-河段", acPrefix + "ebase/hd");
            jsonObject.put("08.拉取-河段VS河长", acPrefix + "ebase/hd_hz");
            jsonObject.put("09.拉取-水库", acPrefix + "ebase/sk");
            jsonObject.put("10.拉取-库片", acPrefix + "ebase/kp");
            jsonObject.put("11.拉取-水库VS河长", acPrefix + "ebase/sk_hz");
            jsonObject.put("12.拉取-渠道", acPrefix + "ebase/qd");
            jsonObject.put("13.拉取-渠段", acPrefix + "ebase/qd2");
            jsonObject.put("14.拉取-渠道VS河长", acPrefix + "ebase/sk_qd");
            jsonObject.put("15.统计-基础信息(拉取)", acPrefix + "ebase/state");
            jsonObject.put("16.同步-上级平台用户id覆盖本地用户id", acPrefix + "user/sync");
            jsonObject.put("17.定时任务-列表", "/api/admin/task/get");
            jsonObject.put("18.定时任务-操作", "/api/admin/task/[update,stop,restart]/{jobName}?cron=?");
            result.data = jsonObject;
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "user/sync")
    public Response userSync() {
        log.info("userSync.........");
        Response result = new Response(0, "同步-上级平台用户id覆盖本地用户id");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":user:sync";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            try {
                userDao.updateInvalidUser();
            } catch (Exception e) {
            }
            try {
                userDao.dropInvalidUser();
            } catch (Exception e) {
            }
            JSONObject res = new JSONObject();
            try {
                List<HashMap<String, Object>> data = Optional.ofNullable(eyBaseRetrieveGmDao.findGmAbnormalAccount()).orElse(new ArrayList<>());
                res.put("处理前#" + data.size(), data);
            } catch (Exception e) {
            }
            try {
                userDao.syncGMCoverUId();
            } catch (Exception e) {
            }
            try {
                List<HashMap<String, Object>> data = Optional.of(eyBaseRetrieveGmDao.findGmAbnormalAccount()).orElse(new ArrayList<>());
                res.put("处理后#" + data.size(), data);
            } catch (Exception e) {
            }
            result.data = res;
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "dsync/task")
    public Response dsyncTask() {
        log.info("dsyncTask.........");
        Response result = new Response(0, "巡查任务");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":dsync:task";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            String dateBegin = request.getParameter("s");
            String dateEnd = request.getParameter("e");
            if (ValidatorUtil.isEmpty(dateBegin) && ValidatorUtil.isEmpty(dateEnd)) {
                dateBegin = DateUtil.getDateStr(new Date());
                dateEnd = dateBegin;
            }
            DSync dSync = new DSync();
            dSync.setDateBegin(dateBegin);
            dSync.setDateEnd(dateEnd);
            taskExecutor.execute(() -> {
                dSyncTask.TaskRecordDSync(dSync);
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "dsync/event")
    public Response dsyncEvent() {
        log.info("dsyncEvent.........");
        Response result = new Response(0, "巡查事件");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":dsync:event";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            String dateBegin = request.getParameter("s");
            String dateEnd = request.getParameter("e");
            if (ValidatorUtil.isEmpty(dateBegin) && ValidatorUtil.isEmpty(dateEnd)) {
                dateBegin = DateUtil.getDateStr(new Date());
                dateEnd = dateBegin;
            }
            DSync dSync = new DSync();
            dSync.setDateBegin(dateBegin);
            dSync.setDateEnd(dateEnd);
            taskExecutor.execute(() -> {
                dSyncTask.TaskEventDSync(dSync);
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "dsync/state")
    public Response dsyncState() {
        log.info("state.........");
        Response result = new Response();
        try {
            String dateBegin = request.getParameter("s");
            String dateEnd = request.getParameter("e");
            if (ValidatorUtil.isEmpty(dateBegin) && ValidatorUtil.isEmpty(dateEnd)) {
                dateBegin = DateUtil.getDateStr(new Date());
                dateEnd = dateBegin;
            }

            List<JSONObject> list = new ArrayList<>();

//            dSync.setType(CommonConstant.TASK_推送_巡查任务);
            PatrolTask patrolTask = new PatrolTask();
            patrolTask.setDateBegin(dateBegin);
            patrolTask.setDateEnd(dateEnd);
            patrolTask.setTaskStatus(CommonConstant.TASK_STATUS_巡查任务_已巡查);

            JSONObject jsonObjectTask = new JSONObject();
            jsonObjectTask.put("type", "巡河任务");
            jsonObjectTask.put("统计时间", StrUtil.asString(dateBegin, "~") + " 至 " + StrUtil.asString(dateEnd, "~"));
            int allCountPatrolTask = patrolTaskDao.dataStatistics(patrolTask);
            patrolTask.setDsyncState(1);
            int finishCountPatrolTask = patrolTaskDao.dataStatistics(patrolTask);
            jsonObjectTask.put("成功数量", finishCountPatrolTask + "/" + allCountPatrolTask);
            jsonObjectTask.put("失败数据", patrolTaskDao.dataFailIsList(patrolTask));
            list.add(jsonObjectTask);

//            dSync.setType(CommonConstant.TASK_推送_巡查事件);
            ReportEvent reportEvent = new ReportEvent();
            reportEvent.setDateBegin(dateBegin);
            reportEvent.setDateEnd(dateEnd);
            reportEvent.setTaskStatus(CommonConstant.TASK_STATUS_巡查任务_已巡查);

            JSONObject jsonObjectEvent = new JSONObject();
            jsonObjectEvent.put("type", "巡河事件");
            jsonObjectEvent.put("统计时间", StrUtil.asString(dateBegin, "~") + " 至 " + StrUtil.asString(dateEnd, "~"));
            int allCountReportEvent = reportEventDao.dataStatistics(reportEvent);
            reportEvent.setDsyncState(1);
            int finishCountReportEvent = reportEventDao.dataStatistics(reportEvent);
            jsonObjectEvent.put("成功数量", finishCountReportEvent + "/" + allCountReportEvent);
            jsonObjectEvent.put("失败数据", reportEventDao.dataFailIsList(reportEvent));
            list.add(jsonObjectEvent);

            result.data = list;
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/xzqh")
    public Response ebaseArea() {
        log.info("ebaseArea.........");
        Response result = new Response(0, "行政区划");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:area";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 行政区划
                eyBaseTaskDSync.dsyncEyBaseRetrieveRegion();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/hz")
    public Response ebaseGm() {
        log.info("ebaseGm.........");
        Response result = new Response(0, "河长");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:Gm";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 河长
                eyBaseTaskDSync.dsyncEyBaseRetrieveGm();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/hl")
    public Response ebaseHL() {
        log.info("ebaseHL.........");
        Response result = new Response(0, "河流");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:hl";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 河流
                eyBaseTaskDSync.dsyncEyBaseRetrieveRivers();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/hd")
    public Response ebaseHd() {
        log.info("ebaseHd.........");
        Response result = new Response(0, "河段");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:hd";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 河段
                eyBaseTaskDSync.dsyncEyBaseRetrieveReachPage();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/hd_hz")
    public Response ebaseHdHZ() {
        log.info("ebaseHdHZ.........");
        Response result = new Response(0, "河段");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:hd_hz";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 河段_河长
                eyBaseTaskDSync.dsyncEyBaseRetrieveGmHydl();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/sk")
    public Response ebaseSk() {
        log.info("ebaseSk.........");
        Response result = new Response(0, "水库");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:sk";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 水库
                eyBaseTaskDSync.dsyncEyBaseReservoirs();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/kp")
    public Response ebaseKp() {
        log.info("ebaseKp.........");
        Response result = new Response(0, "库片");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:kp";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 库片
                eyBaseTaskDSync.dsyncEyBaseReservoirsSlice();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/sk_qd")
    public Response ebaseSkQd() {
        log.info("ebaseSkQd.........");
        Response result = new Response(0, "渠道_河长");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:sk_qd";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 渠道_河长
                eyBaseTaskDSync.dsyncEyBaseRetrieveChnGm();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/sk_hz")
    public Response ebaseSkHZ() {
        log.info("ebaseSkHZ.........");
        Response result = new Response(0, "水库_河长");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:sk_hz";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 水库_河长
                eyBaseTaskDSync.dsyncEyBaseReservoirsGm();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/qd")
    public Response ebaseQd() {
        log.info("ebaseQd.........");
        Response result = new Response(0, "渠道");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:qd";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 渠道
                eyBaseTaskDSync.dsyncEyBaseRetrieveChn();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/qd2")
    public Response ebaseQd2() {
        log.info("ebaseQd2.........");
        Response result = new Response(0, "渠段");
        try {
            String cacheKey = CommonConstant.JWT_IP_COUNT_PREFIX + DateUtil.getCurDateStr("yyyyMMddHHmm") + ":ebase:qd2";
            String countStr = "" + cache.get(cacheKey);
            if (ValidatorUtil.notEmpty(countStr) && ValidatorUtil.isIntNumber(countStr)) {
                Integer count = Integer.valueOf(countStr);
                cache.set(cacheKey, count + 1);
                if (count >= 1) {
                    return Response.error("触发太频繁!");
                }
            } else {
                cache.set(cacheKey, 1);
            }
            taskExecutor.execute(() -> {
                // 渠段
                eyBaseTaskDSync.dsyncEyBaseRetrieveChnSlice();
            });
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = acPrefix + "ebase/state")
    public Response ebaseState() {
        log.info("ebaseState.........");
        Response result = new Response(0, "拉取统计");
        try {
            String dateBegin = request.getParameter("s");
            String dateEnd = request.getParameter("e");
            if (ValidatorUtil.isEmpty(dateBegin) && ValidatorUtil.isEmpty(dateEnd)) {
                dateBegin = DateUtil.getDateStr(new Date());
                dateEnd = dateBegin;
            }
            JSONObject jsonObject = new JSONObject();
            DSync dSync = new DSync();
            dSync.setDateBegin(dateBegin);
            dSync.setDateEnd(dateEnd);
            jsonObject.put("01.统计时间", StrUtil.asString(dateBegin, "~") + " 至 " + StrUtil.asString(dateEnd, "~"));
            jsonObject.put("02.河长统计", eyBaseRetrieveGmDao.dataStatistics(dSync));
            jsonObject.put("03.行政区划统计", eyBaseRetrieveRegionDao.dataStatistics(dSync));
            jsonObject.put("04.河流统计", eyBaseRetrieveRiversDao.dataStatistics(dSync));
            jsonObject.put("05.河段统计", eyBaseRetrieveReachDao.dataStatistics(dSync));
            jsonObject.put("06.河道VS河长-关联信息统计", eyBaseRetrieveGmHydlDao.dataStatistics(dSync));
            jsonObject.put("07.渠道统计", eyBaseRetrieveChnDao.dataStatistics(dSync));
            jsonObject.put("08.渠段统计", eyBaseRetrieveChnSliceDao.dataStatistics(dSync));
            jsonObject.put("09.渠道VS河长-关联信息统计", eyBaseRetrieveChnGmDao.dataStatistics(dSync));
            jsonObject.put("10.水库统计", eyBaseRetrieveReservoirsDao.dataStatistics(dSync));
            jsonObject.put("11.库片统计", eyBaseRetrieveReservoirsSliceDao.dataStatistics(dSync));
            jsonObject.put("12.水库VS河长-关联信息统计", eyBaseRetrieveReservoirsGmDao.dataStatistics(dSync));
            result.data = jsonObject;
        } catch (Exception e) {
            result = Response.error(e.getMessage());
        }
        return result;
    }

    private static List<HashMap<String, Object>> findGmAbnormalAccount() {
        return null;
    }
}
